## EffectiveDoseModel

from libraries.base.signalClasses.RModelFit import *
from libraries.base.signalClasses.RList import *

class EffectiveDoseModel(RModelFit):
    convertToList = [RList, RModelFit] + RModelFit.convertToList
    convertFromList = []
    def __init__(self, widget, data, parent = None, checkVal = False):
        RModelFit.__init__(self, widget = widget, data = data, parent = parent, checkVal = False)
        self.RListSignal = None
    def convertToClass(self, varClass):
        if varClass == RVariable:
            return self
        elif varClass == RModelFit:
            return self
        elif varClass == EffectiveDoseModel:
            return self
        elif varClass == RList:
            return self._convertToList()
        else:
            raise Exception, '%s Not A Known Type' % str(varClass)
    def _convertToList(self):
        if not self.RListSignal:
            self.RListSignal = RList(self.widget, data = 'as.list('+self.data+')', checkVal = False) # we loose the parent at this point because of type conversion
            self.RListSignal.dictAttrs = self.dictAttrs.copy()
            return self.RListSignal
        else:
            return self.RListSignal